package Exercise.Observable;

/**
 * Description：
 * Author: zhangc
 * Date：2017/9/9 11:02
 */
public class Demo {

    public static void main(String[] args) {
        Observable observable = new Observable();
        MyObserved myObserved = new MyObserved();
        MyObserved myObserved1 = new MyObserved();
        observable.addObserver(myObserved);
        observable.addObserver(myObserved1);
        observable.setChanged();
        observable.updateAll("notifyAll");
    }

}

class MyObserved implements Observed {

    @Override
    public void update(Observable observable, Object object) {
        System.out.println(Thread.currentThread() + "  :  " + object);
    }
}